package com.hyzh.latte.sand.socket;

import com.coffee.socketio.handler.SocketioCloseHandler;
import com.corundumstudio.socketio.SocketIOClient;
import com.hyzh.latte.sand.SandSessionManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author: songkui
 * @since: 2024/3/21 0:14
 */
@Slf4j
@Service
public class SandSocketCloseHandler implements SocketioCloseHandler {
    @Override
    public void close(SocketIOClient client) {
        log.info("Sand close channel [sessionId: {}] ", client.getSessionId());
        SandSessionManager.getInstance().removeBySessionId(client.getSessionId().toString());
    }
}
